<?php
if(isset($_POST['lines']))
{
	$ficnm = $_GET['ficnm'];
	$t_lines = preg_split("/<f><f>/",$_POST['lines']);
	if(is_array($t_lines))
	{
		$fp = fopen(_TEMP_."/".$ficnm,"w");
		foreach($t_lines as $key => $s_lines)
		{
			$t_cells = preg_split('/<f>/',$s_lines);
			$olines = '';
			foreach($t_cells as $cid => $value)
			{
				$s_value = preg_split('/<x>/',$value);
				$value = $s_value[0];
				$t_cells[$cid] = utf8_decode($value);
			}
			// With a "," separator
			fputcsv($fp,$t_cells,";");
		}
		fclose($fp);
	}
	echo Msg('FILE',9);
}
?>